package com.tw.trips.domain.fixture;

import java.util.Set;

import com.tw.trips.domain.Location;
import com.tw.trips.domain.Traveller;
import com.tw.trips.domain.Trip;
import com.tw.trips.domain.Update;

public class TravellerFixture {
	private Traveller traveller;

	public TravellerFixture(String emailID, boolean isRegistered, String name,
			String password, Set<Trip> trips, Set<Update> updates,
			Set<Traveller> friends, Set<Location> favLocations) {
		traveller = new Traveller();
		// traveller.setNodeiD(nodeiD);
		traveller.setEmailID(emailID);
		traveller.setRegistered(isRegistered);
		traveller.setName(name);
		traveller.setPassword(password);
//		traveller.setTrips(trips);
//		traveller.setUpdates(updates);
		if (friends != null && !friends.isEmpty())
			traveller.getFriends().addAll(friends);
		if (favLocations != null && !favLocations.isEmpty())
			traveller.getFavLocations().addAll(favLocations);
	}

	public Traveller create() {
		if (traveller == null)
			traveller = this.createTravellerID1();
		return traveller;
	}

	private Traveller createTravellerID1() {
		TravellerFixture fixture = new TravellerFixture("sathish@mindtree.com",
				true, "Sathish", "sathish", null, null, null, null);
		return fixture.create();
	}

	public TravellerFixture() {
		super();
	}
}
